<?php include_once('Connections/tfccom_db.php'); ?>
<?php include_once('Connections/tfccom_select.php'); ?>
<?php
mysql_select_db($database_tfccom_db, $tfccom_db);

$myQuery = "SELECT apartment AS unit,num_bedrooms, ROUND(num_bathrooms) AS num_bathrooms, apartment.apartment, apartment.price, apartment.square_feet, apartment.availability, building.neighborhood_id, building.name, building.address,building.city, building.state, building.zip, building.address_desc, building.description ,building.contact_phone, building.contact_email,full_description, apt_type, building_id
FROM apartment, building
WHERE building.id = apartment.building_id AND apartment.id='". $_GET['id'] ."'";

$rsProperties = mysql_query($myQuery, $tfccom_db) or die(mysql_error());
$row_rsProperties = mysql_fetch_assoc($rsProperties);

	
$query_rsThumbnail = "SELECT * FROM images WHERE category = 'building' AND property_id='". $row_rsProperties['building_id'] ."'";
$rsThumbnail = mysql_query($query_rsThumbnail, $tfccom_db) or die(mysql_error());
$row_rsThumbnail = mysql_fetch_assoc($rsThumbnail);

$query_amenities = "SELECT amenity FROM amenity,bldg_amenity_relation AS bldg WHERE bldg.amenity_id = amenity.id AND bldg.building_id = '". $row_rsProperties['building_id'] ."'";
$amenities = mysql_query($query_amenities, $tfccom_db) or die(mysql_error());
$row_amenities = mysql_fetch_assoc($amenities);

$href=$url_unit_page."?id=".$_GET['id'];
?>
<!DOCTYPE html>

<!--[if lt IE 7]>       <html class="ie6">  <![endif]-->
<!--[if IE 7]>          <html class="ie7">  <![endif]-->
<!--[if IE 8]>          <html class="ie8">  <![endif]-->
<!--[if gt IE 8]><!-->  <html lang='en-US'> <!--<![endif]-->

<head>
<meta charset='UTF-8' />
<meta name="viewport" content="width=640" />
<meta name="format-detection" content="telephone=no" />
<link rel="apple-touch-icon" href="iphone_icon.png" />
<link rel='shortcut icon' href='favicon.ico'>
<link rel='stylesheet' href='css/style.css'>
<link rel='stylesheet' href='css/iosslider.css'>
<title></title>
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/jquery.iosslider.min.js"></script>
<script type="text/javascript" src="js/jquery.easing-1.3.min.js"></script>
<script type="text/javascript">
 
		$(document).ready(function() {

	/* basic - default settings */
	//$('.iosSlider').iosSlider();

	/* some custom settings */
	$('.iosSlider').iosSlider({
					scrollbar: true,
					snapToChildren: true,
					desktopClickDrag: true,
					scrollbarLocation: 'top',
					scrollbarMargin: '10px 10px 0 10px',
					scrollbarBorderRadius: '0',
					responsiveSlideWidth: true,
					infiniteSlider: true,
					startAtSlide: '2'
				});
});
	</script>
<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-9374994-1']);
_gaq.push(['_setDomainName', 'tfcornerstone.com']);
_gaq.push(['_trackPageview']);

(function() {
 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
 })();

</script>
</head>

<body class='unit-page'>

<!-- ****** HEADER ****** -->
<div id='header'>

<div id='title'>
<a href='javascript:javascript:history.go(-1)' class='back-button'>Back</a>
<a href='tel:212.672.1000' class="phone-button-title">Call</a>
<p><?php echo $row_rsProperties['name']; ?></p>
</div>

</div><!-- #header -->

<!-- ****** CONTENT ****** -->
<div id='content'>

<div id='unit-image'>

	<div class = 'iosSlider'>

	<!-- slider -->
	<div class = 'slider' style="width:640px; height:480px; overflow:hidden">
	
<?php 

do{?><div class = 'item' style="background: url(http://www.tfcornerstone.com/images/building/<?php echo $row_rsThumbnail['file_name'];?>) no-repeat 50% 0; background-size:cover ;background-position:50% 50%"></div><?php }while ($row_rsThumbnail = mysql_fetch_assoc($rsThumbnail))?>

	</div>
	<div class='home-logo'><a href='home.php'>Home</a></div>
<table cellpadding='0' cellspacing='0'>
<thead>
<tr>
<td>Unit</td>
<td>Beds</td>
<td>Baths</td>
<td>Sq. Ft.</td>
<td>Price</td>
</tr>
</thead>
<tr>
<td><?php echo $row_rsProperties['unit']; ?></td>
<td><?php
		if($row_rsProperties['num_bedrooms']==0)
		{
		  	echo 'Studio';
		}
		else
		{
		   echo($row_rsProperties['num_bedrooms']);  }?></td>
<td><?php echo $row_rsProperties['num_bathrooms']; ?></td>
<td><?php echo $row_rsProperties['square_feet']; ?></td>
<td>$<?php echo number_format($row_rsProperties['price']); ?></td>
</tr>
</table>

</div>
</div><!-- #unit-image -->

<div id='unit-options'>
<a href='building_page.php?building_id=<?php echo $row_rsProperties['building_id']; ?>' class='building-page button'>Building INFO</a>
<a href='tel:<?php echo $row_rsProperties['contact_phone']; ?>' class='call-agent button'>Call agent</a>
<?php 
$path=$host.$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING'];
?>
<a href='mailto:<?php echo $row_rsProperties['contact_email']; ?>?subject=Inquiry from mobile website&body=Hello, I am inquiring regarding "<?php echo $path; ?>"' class='email-agent button'>Email agent</a>
</div><!-- #unit-options -->

<div id='map-this'>
<p><?php echo $row_rsProperties['address']; ?>, <br><?php echo $row_rsProperties['address_desc']; ?><br> <?php echo $row_rsProperties['city']; ?>, <?php echo $row_rsProperties['state']; ?>&nbsp;<?php echo $row_rsProperties['zip']; ?></p>
<a href='http://maps.google.com/maps?q=<?php echo $row_rsProperties['address']; ?>,&nbsp;<?php echo $row_rsProperties['city']; ?>,&nbsp;<?php echo $row_rsProperties['state']; ?>&nbsp;<?php echo $row_rsProperties['zip']; ?>' class='map-this button'>Map this</a>
</div><!-- #map-this -->

<div id='unit-description'>
  <p><?php echo $row_rsProperties['description']; ?></p>
 </div><!-- #unit-description -->
<div id='amenities'>
<h2>Amenities</h2>
<p><?php
$amenity="";
while ($row_amenities = mysql_fetch_assoc($amenities))
{
	$amenity =  $amenity.$row_amenities['amenity'].",&nbsp;";
}
echo rtrim($amenity, ",&nbsp;");
?>
</p>
</div><!-- #amenities --> 
<?php
$fileimg='http://www.tfcornerstone.com/residential/floorplans/'.$row_rsProperties['building_id'].'_'.$row_rsProperties['apartment'].'.png';

 if(@fopen($fileimg,"r")){

?>
<div id='floor-plan'>
<h2>Floor plan</h2>
<img src="http://www.tfcornerstone.com/residential/floorplans/<?php echo $row_rsProperties['building_id']; ?>_<?php echo $row_rsProperties['apartment']; ?>.jpg" width="377" height="408" border="0"/>
</div><!-- #floor-plan -->
<?php
}
?>



<div id='share'>
<a href="mailto:?subject=Check out this apartment listing from TF Cornerstone&body=<?php echo $href; ?>%0d%0a%0d%0a<?php echo $row_rsProperties['address']; ?>,<?php echo $row_rsProperties['address_desc']; ?>&nbsp;<?php echo $row_rsProperties['city']; ?>, <?php echo $row_rsProperties['state']; ?>&nbsp;<?php echo $row_rsProperties['zip']; ?>%0d%0a%0d%0aUnit:<?php echo $row_rsProperties['unit']; ?>,Beds:<?php if($row_rsProperties['num_bedrooms']==0){ echo 'Studio';} else{ echo($row_rsProperties['num_bedrooms']);  }?>,Baths:<?php echo $row_rsProperties['num_bathrooms']; ?>,Sq. Ft.:<?php echo $row_rsProperties['square_feet']; ?>,Price:$<?php echo number_format($row_rsProperties['price']); ?>" class='email button'>Email info to a friend</a>
<a href='http://www.facebook.com/sharer.php?u=<?php echo $href; ?>' target="_blank" class='facebook button'>Share on Facebook</a>
<a href='http://twitter.com/share?url=<?php echo $href; ?>&text=I’m checking out this apt!' target="_blank" class='twitter button'>Share on Twitter</a>
</div><!-- #share -->


</div><!-- #content -->

 <!-- ****** FOOTER ****** -->
<div id='footer'>

<a href="home.php"><div class='logo'><p>TF Cornerstone</p></div></a>


<div class='contacts'>
<p>387 Park Ave South, New York, NY 10016</p>
<p>MAIN: 212.672.1000 FAX: 212.672.1001</p>
</div>

<a class='full-site-button' href='http://www.tfcornerstone.com?desktop'>FULL SITE</a>

<div style="color:white; margin:20px 0 20px 0;overflow:auto">
          <div style="float:left;border-right:solid white;padding:0 30px 0 30px"><a href="home.php" style="font-size:28px;color:white">HOME</a></div>
          <div style="float:left;border-right:solid white;padding:0 30px 0 30px"><a href="about.php" style="font-size:28px;color:white">ABOUT</a></div>
          <div style="float:left;padding:0 0 0 30px"><a href="http://www.tfc.com/forms/privacy_policy.php?back=false" target="_blank" style="font-size:28px;color:white">DISCLAIMER</a></div>
</div>
<ul class='icons'>
<li class='google-plus'><a href="http://gplus.to/tfcornerstone" target="_blank">Google+</a></li>
<li class='twitter'><a href="http://twitter.com/#!/tfcornerstone" target="_blank">Twitter</a></li>
<li class='facebook'><a href="https://www.facebook.com/TFCrealestate" target="_blank">Facebook</a></li>
<li class='youtube'><a href="http://www.youtube.com/tfcornerstone" target="_blank">Youtube</a></li>
<li class='linked-in'><a href="http://www.linkedin.com/company/tf-cornerstone" target="_blank">Linked In</a></li>
<li class='rss'>
<?php
if(strstr($_SERVER['HTTP_USER_AGENT'],'Android')) { 
?>
	<a href="http://www.tfcornerstone.com/new-york-city-life/" target="_blank">RSS</a>
<?php	
} 
else { 
?>
	<a href="http://www.tfcornerstone.com/new-york-city-life/feed/" target="_blank">RSS</a>
<?php
}
 ?></li>
<li class='helper'></li>
</ul>

<p class='copyright'>&copy; 2012 <span>TF Cornerstone</span> INC</p>
<p class='copyright' style=" font-size:12px">EQUAL HOUSING OPPORTUNITY</p>
</div><!-- #footer -->
</body>
</html>